<template>
  <div class="login-page">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="手机" prop="tel">
        <el-input v-model="ruleForm.tel" placeholder='测试中，容易出现ip高频，网易粑粑会封ip的，所以此页面关闭中'></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input v-model="ruleForm.password" type="password"placeholder='测试中，容易出现ip高频，网易粑粑会封ip的，所以此页面关闭中'></el-input>
      </el-form-item>
      <el-form-item label-width="100px">
        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  name: 'login',
  data () {
    return {
      ruleForm: {
        tel: null,
        password: ''
      },
      rules: {
      }
    }
  },
  mounted () {
  },
  methods: {
    submitForm (formName) {
      let _this = this
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(_this.ruleForm.tel)
          console.log(_this.ruleForm.password)
          this.$http.get('/login/cellphone?phone=' + _this.ruleForm.tel + '&password=' + _this.ruleForm.password).then(function (response) {
            console.log(response)
            console.log('↑↑↑↑↑__ 登录信息 __↑↑↑↑↑')
          }).catch(function (error) {
            console.log(error)
          })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }
    // handleSelect (key, keyPath) {
    //   console.log(key, ':', keyPath)
    // },
    // handleIconClick () {
    //   // 获取搜索列表
    //   this.searchConent === '' ? this.isSongList = false : this.isSongList = true
    //   let _this = this
    //   let _searchConent = this.searchConent
    //   this.$http.get('/search?keywords=' + _searchConent + '&limit=99').then(function (response) {
    //     console.log(response)
    //     _this.musicList = response.data.result.songs
    //   }).catch(function (error) {
    //     console.log(error)
    //   })
    // },
    // clickSong (id, pic, artistsName, songName) {
    //   var _this = this
    //   // 歌曲url获取
    //   this.$http.get('/music/url?id=' + id).then(function (response) {
    //     console.log(response.data.data[0])
    //     console.log('↑↑↑↑↑__URL__↑↑↑↑↑')
    //     let obj = {
    //       id: id,
    //       url: response.data.data[0].url,
    //       pic: pic,
    //       author: artistsName,
    //       title: songName
    //     }
    //     _this.currentList = obj
    //     _this.songList.push(obj)
    //     _this.flag = true
    //   }).catch(function (error) {
    //     console.log(error)
    //   })
    // }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
@import '../assets/fonts/iconfont.css';
</style>
